<?php
/**
 *
 * Customer Seach Result Grid
 *
 */

use Fox\Grid\FieldCat\Field\Renderer\Anchor;
use Fox\Generator;
use Fox\Common\Customer\Type;
use Fox\Html\AnchorObject;

global $typeLabel;
$grid = new Fox\Grid("gResult");
$grid->fieldcat(array(array("customer_type","type"),"name1","status",array("contact_source","source"),"uname","udate"));
$grid->fieldcat()->switchToObjectMode();
// Status
$grid->fieldcat()->setGenerators(array(
	'type' => Generator::useFunction(function($data){
		return $data->type()->label;
	}),
	'source' => Generator::useFunction(function($data){
		return $data->source()->label;
	}),
	'status' => Generator::useFunction(function($data){
		return $data->status()->label;
	})
));
$grid->fieldcat()->field('udate')
			->align('left')
			->displayTime();
$grid->setFieldAttr(array("name1",'source',"status"),"renderers",new Anchor(
		Generator::url('contacts','main',null,
					array('inLineId' => Generator::useAttribute('contactid'))
		)));
return $grid;